﻿using System;
using System.Collections.Generic;

using E.BLL;
using E.Model;
using E.Web.UI.Page;

using X.Pager;
using X.Pager.List;
using X.Common;

namespace E.Web.training.course
{
    public partial class LearningProcess : BasePage
    {
        public IList<StudyLogForListModel> studyList;
        public IList<CourseCategoryModel> cc_list;
        public string coursename = "";
        public int categoryid = -1;

        protected override void ShowPage()
        {
            cc_list = GetCourseCategoryList();
            string act = XRequest.GetString("act");
            coursename = XRequest.GetString("CourseNameTxt");
            categoryid = XRequest.GetInt("CategorySlt", -1);


            if (ispost || act == "s")
            {
                SearchStudyLogModel model = new SearchStudyLogModel();

                //ClassBLL bll = new ClassBLL();
                //ClassModel model = new ClassModel();
                StudyBLL bll = new StudyBLL();
                model.CourseName = coursename;
                model.CourseCategoryID = categoryid;
                model.StartFromTime = "";
                model.StartToTime = "";
                model.EndFromTime = "";
                model.EndToTime = "";
                model.UserID = userid;

                //ClassListModel listModel = new ClassListModel();
                StudyLogListModel listModel = new StudyLogListModel();

                CheckPageIndexValue(XRequest.GetInt("s", 1) - 1, XRequest.GetInt("g", 0), XRequest.GetInt("z", customerPageSize));

                //listModel = bll.SearchClassByCondition(model, customerPageSize, pageIndex);
                listModel = bll.GetStudyLogByCondition(model, customerPageSize, pageIndex);

                if (listModel.TotalCount > 0)
                {
                    count = listModel.TotalCount;
                    studyList = listModel.List;
                    PagerBase pager = new ListPager(count, pageIndex, currentPgGroup, customerPageSize, defaultPagesInGroup);
                    Dictionary<string, string> parms = new Dictionary<string, string>();
                    parms.Add("act", act);
                    parms.Add("CourseNameTxt", coursename);
                    parms.Add("CategorySlt", categoryid.ToString());
                    mypager = pager.DrawPager("selfpager", parms);
                }
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {

        }
    }
}
